<?php
Yii::import("ext.yii-mail.*");
class MailController extends Controller
{
	public function actionRegister(){
		if(Yii::app()->user->isGuest)
		{
			jsonOut(array(
				'error'=>false,
				'message'=>'User is Guest'
			));
		}
		
		$message            = new YiiMailMessage;
           //this points to the file test.php inside the view path
        $message->view = "registration";
        $user = currentUser();
		
        $params              = array(
			'attr'=>$user['user']->attributes
		);
        $message->subject    = 'Congratulations, '.$user['user']->username.', your registration is complete!';
        $message->setBody($params, 'text/html');                
        $message->addTo($user['user']->email);
        $message->from = array(Yii::app()->params['adminEmail']=>'Phan Thinh');   
        Yii::app()->mail->send($message);      
	}
}